/*
 * @Author: yangrongxin
 * @Date: 2021-08-18 15:13:45
 * @LastEditors: yangrongxin
 * @LastEditTime: 2021-08-18 15:18:15
 */
import { ArticleItem, VideoItem } from '../index';

export enum ARTICLE_TYPE {
  ARTICLE = '1', // 对应文章
  VIDEO = '2', // 对应视频
}

/* 根据传入的参数判断当前展示文章元素 还是视频元素 */
const RenderItemComponent = (props) => {
  const { type, ...otherProps } = props;
  if (String(type) === ARTICLE_TYPE.ARTICLE) {
    return <ArticleItem {...otherProps} />;
  }
  return <VideoItem {...otherProps} />;
};

export default RenderItemComponent;
